// https://threejs.org/docs/#api/en/renderers/webgl/WebGLProgram

varying vec4 viewPosition;
varying vec3 viewNormal;

void main(){
    //we cast the vec3 attribute position into a vec4
    //why .w is 1 is a topic on its own, but it represents
    //a position in space, versus a direction

    vec4 _position = vec4(position, 1.);

    viewPosition = modelViewMatrix * _position;

    viewNormal = normalize(normalMatrix * normal);


    gl_Position = projectionMatrix * viewPosition;
}